package com.uinnova.product.eam.mvc;

import com.binary.framework.web.RemoteResult;
import com.binary.jdbc.Page;
import com.uinnova.product.eam.feign.workable.entity.AllDiagramInstanceDto;
import com.uinnova.product.eam.service.DiagramReviewInfoSvc;
import com.uinnova.product.eam.service.impl.GTDiagramApprovalSvcImpl;
import com.uinnova.product.eam.vo.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/diagram/approval")
public class DiagramApprovalController {

    @Autowired
    private GTDiagramApprovalSvcImpl diagramApprovalSvc;
    @Autowired
    private DiagramReviewInfoSvc diagramReviewInfoSvc;

    @GetMapping("/info")
    public RemoteResult info(@RequestParam String processInstanceId, @RequestParam String businessKey, @RequestParam String taskId) {
        DiagramApproveInfo approveInfo = diagramApprovalSvc.approveInfo(processInstanceId, businessKey, taskId);
        return new RemoteResult(approveInfo);
    }


    @PostMapping("/list")
    public RemoteResult approveInfo(@RequestBody DiagramReviewQueryReq req) {
        Page<DiagramReviewRes> page = diagramReviewInfoSvc.page(req);
        return new RemoteResult(page);
    }

    /**
     * 获取所有视图流程信息保存到视图评审流程表中
     */
    @GetMapping("/getAllDiagramProcess")
    public RemoteResult getAllDiagramProcess() {
        diagramReviewInfoSvc.getAllDiagramProcess();
        return new RemoteResult("数据跑批完成！");
    }

}
